Products

Solutions

Resources

Partners

Community

Blog

About

QA

Ideas Test

New Community Website

Ordinarily, you'd be at the right spot, but we've recently launched a brand new community website... For the community, by the community.

Yay... Take Me to the Community!

Welcome to the DNN Community Forums, your preferred source of online community support for all things related to DNN.
In order to participate you must be a registered DNNizen

HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIdnn.xml and dnn.xml.jsparse namespace dnn.xml and dnn.xml.jsparse namespace
Previous
 
Next
New Post
5/17/2006 5:57 PM
 

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 9:35 AM
 

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 1:05 PM
 

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 4:45 PM
 

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
 
Next
HomeHomeDNN Open Source...DNN Open Source...Provider and Extension ForumsProvider and Extension ForumsClientAPIClientAPIdnn.xml and dnn.xml.jsparse namespace dnn.xml and dnn.xml.jsparse namespace


These Forums are dedicated to discussion of DNN Platform and Evoq Solutions.

For the benefit of the community and to protect the integrity of the ecosystem, 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 DNN.
  2. No vendor trolling / poaching. If someone posts about a vendor issue, allow the vendor or other customers to respond. Any post that looks like trolling / poaching will be removed.
  3. Discussion or promotion of DNN Platform product releases under a different brand name are strictly prohibited.
  4. No Flaming or Trolling.
  5. No Profanity, Racism, or Prejudice.
  6. Site Moderators have the final word on approving / removing a thread or post or comment.
  7. English language posting only, please.
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out
What is Liquid Content?
Find Out