Small width layout Medium width layout Maximum width layout Small text Medium text Large text
     Search
Downloads Downloads Directory Directory Forums Forums Forge Forge Blogs Blogs        Marketplace Marketplace Careers Program Careers
Community › Forums Register  |  

Maximum ASP
  Ads  
 


  Sponsors  

Meet Our Sponsors

FCKeditor Project
Salaro -- Skins and more
OnyakTech
CrystalTech Web Hosting™
Webhost4life, specialists in DNN hosting
Mad Development is a full service interactive agency focusing on the merge of design, technology, e-commerce, and affiliate marketing by providing total website solutions.
 


DotNetNuke Forums
 
  Forum  DotNetNuke® Pro...  ClientAPI Compo...  dnn.xml and dnn.xml.jsparse namespace
Previous Previous
 
Next Next
New Post 5/17/2006 3:57 PM
User is offline Phebous Williams
4 posts
www.ricecheesesoftware.com
10th Ranked


dnn.xml and dnn.xml.jsparse namespace  

I am running into some strange behaviors when using the dnn.xml and dnn.xml.jsparse namespaces.  Let me first start with the dnn.xml.  In my javascript, this is the code:

var oDoc = new dnn.xml;
oDoc.init(); 
oDoc.loadXml(sXml);

 When the init function runs, it determines the browser type and loads the appropriate parsing type (i.e. MSXML, DOMParse, or JsParse).  The challenge I run into is that with IE, the parserName is "ActiveX", so it will load the default JsParse and error out because the dnn.xml.jsparse namespace has not been loaded.  By writing this, it has got me thinking again.  This maybe associated with the order of loading the dnn.xmlhttp and the dnn.xml namespace.  So, I will continue the next strange behavior I am experiencing.

When using the dnn.xml.jsparse namespace with Opera browser, I am not getting the data out of the nodes as expected.  For example, with IE and Firefox, I can use this javascript to retrieve data from a xml document.  Here is the code:

//this is the xml string
<name>
   <test>
      <1>One</1>
   </test>
</name>

// this is the javascript
var oDoc = new dnn.xml;
oDoc.loadXml(sXml);

var myvariable = oDoc.childNodes(0).childNodes(0).getXml();

//results of code
The result of myvariable is "One" for IE and Firefox.  For Opera, whom uses the jsparse, returns "".  After futher investigation, I have discoverd the problem.  This is the structure of the xml doc:

<name>
   <test>
      <1></1>
      One
   </test>
</name>

So, my impression that the jsparse is not populating the oDoc object in the same manner that the ActiveX or DomParser is performing.  I have started rewriting the jsparse, but then I stopped to get input if I am barking up the wrong tree.  I haven't seen any talk with regards to the actual namespaces and actual usage.  I am hoping this note could spawn some dialog. 

Thanks,

Phebous...

 

 
New Post 5/18/2006 7:35 AM
Online now... Jon Henning
1622 posts
www.codeendeavors.com
5th Ranked










Re: dnn.xml and dnn.xml.jsparse namespace  

The first thing to note is that you should not be loading the namespaces this way.  You should let the ClientAPI register the appropriate namespaces instead.

ClientAPI.RegisterClientReference(Me.Page, ClientAPI.ClientNamespaceReferences.dnn_xml)

It will automatically determine based on browser whether only the wrapper for the xml logic should be loaded, or whether the javascript xml parser is needed.  (IE, FireFox, Mozilla, and Netscape come with their own parsers and therefore do not need a reference to the jsparser.)  The RegisterClientReference will detect this and do the right thing.

You would then obtain an xml document with this code.

var oDoc = new dnn.xml.createDocument();

oDoc.loadXml(sXml);

The code you are attempting does not make sense, for you are trying to instantiate a namespace, not an object.

You should note that the xml you are testing is not valid as well.

The IE XML parser throws this error:  A name was started with an invalid character.

Finally, I want to note that the javascript xml parser is not a full blown xml parser and could use some improvement.  It works with rather simple XML but for scenerios like you mention where you have text found within an element that contains other elements it probably will not function.  If you keep your xml straight forward you will not have any issues.

I suggest having a look at how these namespaces are used in some functioning code, like the DotNetNuke Webcontrols.  This may prove to be helpful in your developing with the ClientAPI.

 


 
New Post 5/18/2006 11:05 AM
User is offline Phebous Williams
4 posts
www.ricecheesesoftware.com
10th Ranked


Re: dnn.xml and dnn.xml.jsparse namespace  

Jon,

Thank you for your time and input.   I apologized about the post and some of the appalling mistakes I made.  I was writing from memory and not while sitting in front of the code.  I will wait to make any further comments about the code until I am in front of it.  I am glad to hear that the order was taken into account when loading in the namespaces. 

You have made one comment that has me worried.  It was: "you should note that the xml you are testing is not valid as well."  I am wondering if you were referencing the this:

//this is the xml string
<name>
   <test>
      <1>One</1>
   </test>
</name>

Or the mangled representation of the Opera oDoc objects that you are referencing?  If this testing xml above is not compliant, can you tell me what is wrong?

I will also perform some testing on some un-nested elements to determine if it is a nesting of the elements is the problem.  I figured that, since you have done some beautiful recursion, it would deal with the nesting of elements.  I was, however, a bit puzzled though with dealing of the xml in a character by character manner.  I would have used a regular expression more line of something like this:  <(.*)>(.*)<\/\1>.   I am sure that if I were a bit more versed in xml and all the rules around it, I could craft a regular expression to deal with it in a much easier manner.  I do know that this worked for me since I wrote my own parser to work around my parsing problem with the api. 

Regards,

Phebous...

P.S.  Thanks for all your hard work on DNN!

 
New Post 5/18/2006 2:45 PM
Online now... Jon Henning
1622 posts
www.codeendeavors.com
5th Ranked










Re: dnn.xml and dnn.xml.jsparse namespace  

I was referring to that xml.  If you save that xml to something like Test.xml and open it in IE you will see the error I mentioned.  I believe that a element name cannot start with a number.

Regarding my primitave js parser.  It was done character by character due to the fact that I don't know regular expressions all that well.  If you look at the comments in the file you will see this.

//primitive Js Xml Parser ---------------------------------------------------------------------------------------------------------

//sure a regular expression guru could make better


 
Previous Previous
 
Next Next
  Forum  DotNetNuke® Pro...  ClientAPI Compo...  dnn.xml and dnn.xml.jsparse namespace
 


Forum Policy

These Discussion Forums are dedicated to the discussion of the DotNetNuke Web Application Framework.

For the benefit of the community and to protect the integrity of the project, please observe the following posting guidelines:

1. No Advertising. This includes promotion of commercial and non-commercial products or services which are not directly related to DotNetNuke.
2. Discussion or promotion of DotNetNuke product releases under a different brand name are strictly prohibited.
3. No Flaming or Trolling.
4. No Profanity, Racism, or Prejudice.
5. Site Moderators have the final word on approving/removing a thread or post or comment.
6. English language posting only, please.

 


Swirlhost Inc.
Affordable DotNetNuke Hosting, Skin Development, Custom Module Development, and DotNetNuke Consulting. We will install your preference of DNN and now host with us and get a free license for the Swirl AJAX Chatroom Module.
www.swirlhost.com
Active Modules, Inc.
Creators of Active Forums, the best forum module for DotNetNuke
www.activemodules.com
DNNCovered.com - Your Offshore Dotnetnuke Partner
Dnncovered.com is the only Dotnetnuke offshore outsourcing center specializes in DNN skinning and module development with lowest pricing and quality service. Our staff is dedicated to websites based on DNN and our graphic designers are creative and imaginative well enough to provide customers the complete set of skinning solutions and packages
www.dnncovered.com

DotNetNuke Corporation   Terms Of Use  Privacy Statement
DotNetNuke®, DNN®, and the DotNetNuke logo are trademarks of DotNetNuke Corporation
Hosted by MaximumASP