User Profile

Collapse

Profile Sidebar

Collapse
bonjo
bonjo
Last Activity: Dec 18 '13, 09:18 AM
Joined: Oct 28 '13
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • bonjo
    replied to Merging schema xml with data xml with Java
    in Java
    Well, I didnt do much, just used System.nanoTime () to measure the difference.
    so I did:
    Code:
    sum = 0;
    and repeated 1000 times:
    Code:
    startTime = System.nanoTime();
    **operation**
    endTime = System.nanoTime();
    sum += (endTime - startTime)/1e9;
    and at the end, the average time is
    Code:
    sum/1000
    See more | Go to post

    Leave a comment:


  • bonjo
    replied to Merging schema xml with data xml with Java
    in Java
    Well, I promised to update about time measurements.
    so, I tried two approaches:
    1. Having an xml with embedded JS.
    I construct a dom-tree, locate js scripts and run it.
    2. Having an xsl file. using TransformerFact ory to create an output xml of it.

    Simulating with 10runs gives the following time (seconds):
    JS: 0.03374
    XSL: 0.04
    Thats already very close.
    When going for larger runs, it gets...
    See more | Go to post

    Leave a comment:


  • bonjo
    replied to Merging schema xml with data xml with Java
    in Java
    Also, another interesting question, is it possible to debug the ScriptEngine instructions?
    Same as you debug a js in browser / attach to process in Script mode with VS?
    See more | Go to post

    Leave a comment:


  • bonjo
    replied to Merging schema xml with data xml with Java
    in Java
    Im still investigating my options.
    I might prefer the JS engine after all.
    but I wonder what is the best way to reconstruct my xml file to a data structure that JS Engine will work easily with.
    What is it that you say about json? can you explain a bit further that point?
    See more | Go to post

    Leave a comment:


  • bonjo
    replied to Merging schema xml with data xml with Java
    in Java
    I'd gladly try to measure that, but first I need to understand how to accomplish it :-)
    Its a bit of a mixup, as I cant really use only JS to iterate over my data.xml and evaluate statements over it.
    I will still need, this way or another, to use some kind of xpath, just in javascript.
    either that, or I will create some multi dimensional array holding all my xml elements and their attributes,
    and evaluate the javascript...
    See more | Go to post

    Leave a comment:


  • bonjo
    replied to Merging schema xml with data xml with Java
    in Java
    Yes, That was a mistake.
    Using XPath 1.0 seems very problematic.
    perhaps I should look at a different direction.
    I also need the strength to do if-elseif-elseif-else, and maybe if-if-if statements.
    how severe in performance is using the ScriptEngine to evaluate javascript expressions?
    See more | Go to post

    Leave a comment:


  • bonjo
    replied to Merging schema xml with data xml with Java
    in Java
    I prefer using xpath engine ( I guess runtime will be much better comparing to js engine) But its not accepting those if statements.
    I try the following:
    exp = "if (/row/field[@name='service']) then 'Ms.' else 'Mr.'";
    res = xPath.compile(e xp).evaluate(xm lDocument);
    but then I get javax.xml.trans form.Transforme rException: Could not find function: if

    Is it, for sure, exists in java xpath engine?
    See more | Go to post

    Leave a comment:


  • bonjo
    replied to Merging schema xml with data xml with Java
    in Java
    So I should, after having a dom-tree, use xpath in java to select all attributes (according to my example, all 'title' attributes), and in those attributes i should write xpath code, and evaluate it on my second (data) dom-tree?
    then, replace the attribute's value to the evaluated one?
    I can see how I can pull information, but how can I tell in xpath if statements, so that if it found that a certain value is 'X', assign 'Y' to that attribute....
    See more | Go to post

    Leave a comment:


  • bonjo
    started a topic Merging schema xml with data xml with Java
    in Java

    Merging schema xml with data xml with Java

    Hello everyone,
    I wish, based on two xml:
    1. ui.xml: defines a layout, based on variables/conditions in its attributes, such as:
    Code:
    <root>
    <item title="if data/gender = 'female': Ms.; else: Mr." />
    </root>
    2. data.xml: defines actual data came from another data source:
    Code:
    <data>
    <gender>male</gender>
    </data>
    to merge...
    See more | Go to post

  • bonjo
    replied to Some sort of xsl embedded in xml?
    in XML
    Well, you're right. Sorry for targeting it from one subforum to the other.
    I will continue my journey there.
    have a good day
    See more | Go to post

    Leave a comment:


  • bonjo
    replied to Some sort of xsl embedded in xml?
    in XML
    And how to I "tell" the xsl-to-xml engine to read an xml file and evaluate its attributes, where it indeed contains xsl code? is that possible? (in the form I supplied)

    Im doing the entire programming in JAVA, in case there're other approaches.
    I started thinking about using handlebars.java as a templating engine, and then simply read the input file as an xml, re-writing it while evaluating its attributes with handlebars....
    See more | Go to post

    Leave a comment:


  • bonjo
    started a topic Some sort of xsl embedded in xml?
    in XML

    Some sort of xsl embedded in xml?

    I wish to find some leads here.
    My desire is such - to define a UI of some sort by XML (similar to xaml with c#).
    I have a known xml elements / attributes and order.
    I also have another xml, that contains data.
    I wish to use conditions in my ui.xml that defines attribute's values according to the data.xml.
    example:
    ui.xml:
    Code:
    <root>
    <item title="if data/gender = 'female': Ms.; else: Mr."
    ...
    See more | Go to post
    Last edited by Rabbit; Oct 28 '13, 03:56 PM. Reason: Please use [CODE] and [/CODE] tags when posting code or formatted data.
No activity results to display
Show More
Working...