2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 2017 2018 2020

11/29/2001: JudoScript - a Dynamic Form of Java

UPDATE (2007-11-21) JudoScript is still around and still as easy to use as ever. Groovy has a lot of mindshare but JudoScript is simpler to use, I think.

I’ve found an interesting meta-langauge for Java called JudoScript. Here is the first paragraph of that page:

JudoScript is a full-fledged, modern scripting language, built on and for the Java Platform. It seamlessly interacts with Java objects, does most operating system shell tasks with many bells and whistles, supports easy and versatile JDBC scripting, XML scripting, built-in scheduler and many other niceties.

11/28/2001: How to Parse XML Using Oracle And PLSQL

After a bit of research, I've figured out how to parse xml using Oracle9i. The process is a bit more involved than Oracle8i but there is more functionality. The following bit of PL/SQL code will parse the following XML:

<r session="sess01" updator="medined" object="1005769145473">
 <f n="PMA_APPROVAL_MEANS" v="Identicality Per FAR 21.303(c)"/>
</r>

You'll need to place the following code into context that makes sense for your projects, but here is the gist:

-- declare attributes
p          xmlparser.Parser;
doc        xmldom.DOMDocument;
element    xmldom.DOMElement;
facts      xmldom.DOMNodeList;
node       xmldom.DOMNode;
attributes xmldom.DOMNamedNodeMap;

-- parse the xml packet
p := xmlparser.newParser;
xmlparser.setValidationMode(p, FALSE);
xmlparser.parseBuffer(p, v_xml_packet);
doc  := xmlparser.getDocument(p);

BEGIN
  element := xmldom.getDocumentElement(doc);
EXCEPTION
  RAISE;
END;

v_session := xmldom.getAttribute(element, 'session');
v_updator := xmldom.getAttribute(element, 'updator');
v_object  := xmldom.getAttribute(element, 'object');

facts := xmldom.getChildrenByTagName( element, 'f');
FOR j IN 1..xmldom.getLength(facts) LOOP

        node := xmldom.item(facts, j-1);
        attributes := xmldom.getAttributes(node);

        if (xmldom.isNull(attributes) = FALSE) then
          num_attributes := xmldom.getLength(attributes);

          -- loop through attributes
          for i in 0..num_attributes-1 loop
             node := xmldom.item(attributes, i);
             attribute_name := xmldom.getNodeName(node);
             if attribute_name = 'n' then
                 v_fact_name := xmldom.getNodeValue(node);
             end if;
             if attribute_name = 'v' then
                 v_fact_value := xmldom.getNodeValue(node);
             end if;
          end loop;

          ---- do some processing here.

       end if;
END LOOP;