Special xml viewer java 6

Dear all,
I want to create a special xml viewer in java 6 and I was wondering if there are already some things available in Java 6.
I just want to display the xml in a panel with indents and colouring like you would open it in internet explorer.
The only difference is that when I click on a tag, it would display the content of this tag in another Panel.
So I have basically 2 problems: - display a coloured xml with indents
- make the tags clickable so every click picks up it's content so it can be displayed
I watched the api but it is very confusing which package to choose.
Thanks

Here's an example that uses JTree, which is the easy way out: http://www.javalobby.org/java/forums/t19666.html
Otherwise welcome to styled documents and the javax.swing.text package.

Similar Messages

  • Problem while reading special characters in java

    Hi i am faving the follwing xml.
    <ns1:dc_application_bullets>
    <w:p wsp:rsidR="004E4084" wsp:rsidRPr="007024E6" wsp:rsidRDefault="000D5B97" wsp:rsidP="007024E6">
    <w:r>
    <w:rPr>
    <w:rFonts w:ascii="Arial Unicode MS" w:fareast="Arial Unicode MS" w:h-ansi="Arial Unicode MS" w:cs="Arial Unicode MS" w:hint="fareast" />
    <wx:font wx:val="Arial Unicode MS" />
    <w:lang />
    </w:rPr>
    <w:t>������</w:t>
    </w:r>
    </w:p>
    </ns1:dc_application_bullets>
    no i ma trying to parse this XML using java program and jdom parser. when i try to read the special chacters and print then i ma getting ?? on the console.
    how can i print on to the console as the one what they look.
    any help is appreciated.

    please any bosy throw some light on this.You first. Do you think we're mindreaders? Reading and printing code please.

  • Read, Modify and Apply Report XML using Java Script

    Hi Guys,
    Is there any way that we can Pragmatically Read, Modify and Apply Report XML using Java Script or some other way.
    Thanks
    Kaushik
    Edited by: Kaushik K on Jun 20, 2012 8:36 PM

    Requirement ::
    Users should be able to add Column to the Report Dynamically at Runtime.
    (There are around 1000+ Users, Answers Approach is not acceptable)
    So we are planning to provide a Multi Select / Shuttle Box Option for Users to add Columns dynamically. (Only for Table View)
    What we planned to DO ::
    Create a Presentation Variable Prompt, Which reads the Metadata Table (Presentation Table.Column Name, populated using the Metadata Dictionary)
    And Create a report with One Column and the Column Fx like @{var_dynamic_columns}{'"Time"."Year","Time"."Month"'}
    With this, OBIEE is rewriting the Logical SQL Currently as "Select "Time"."Year","Time"."Month" from "A - Sample Sales" "
    But getting an error
    The number of columns returned in retrieving column metadata was invalid (expected: 1; received: 2)
    So we want to see, if we can rewrite the Advanced XML of the Report to have dynamic columns based on the Values from the Presentation Variable.
    Please help me if this is a viable solution or any other better solution.

  • Convert MBox into XML into Java Objects

    Hello all,
    this is a general question, i dont know weather there is such libs or not.
    However, please tell me what you know.
    i want to program a java application for searching purpose in Mbox.
    i thought its possible and easier to try to convert the emails from the MBox into XML files, and from these create java objects when i need or even convert the XML into html for viewing.
    Any suggestions are welcome.
    Also antoher solutions are greate.
    thanks in advance!
    Sako.

    I don't know what this MBox you speak of is - I assume it's not the thing I use to hook upa guitar to GarageBand. Maybe you mean it as a generic term for mailbox? The easiest solution (to my mind) would be to use a Java API provided by whatever MBox is. If there is no such thing, then if you get XML-formatted version of the messages I suppose writing code to parse the XML into Java Objects would be a good option if you wanted to do further manipulation of them, but if all you want to do is display them as HTML in a browser then just use XSLT to transform them.
    Good Luck
    Lee

  • How to escape special xml characters in ALSB

    Hi
    Can some one tell me how to replace special xml characters < ,> with &lt; and &gt;
    I have xml node like below
    <payload>
    <RatingDetails>
    <Action>Add</Action>
    </payload>
    Using fn-bea:serialize i got xml string as
    <payload><RatingDetails><Action>Add</Action></payload>
    I want output as below
    <payload>&lt;RatingDetails&gt;&lt;Action&gt;Add&lt;/Action&gt;</payload>
    Appreciate your help
    Thanks in Advance

    when i use fn-bea:serialize my request xml node converted to xml string.To that string i had escaped special xml characters.
    Original request:
    <abc>
    <a1 >123</a1>
    <payload>
    <d>345</d>
    <e><678></e>
    </payload>
    </abc>
    After using serialize it became as below (everything in one line)
    <abc><a1>123</a1><payload><d>345</d><e><678></e></payload></abc>
    then i used java callout for replacing special xml chars in payload element,
    now my request is
    <abc><a1>123</a1><payload><![CDATA[& lt;d& gt;345& lt;/d& gt;& lt;e& gt;& lt;678& gt;& lt;/e& gt;]]></payload></abc>
    i dont want my payload data to be enclosed within CDATA but by default i am getting it when i run my xquery for generating request.
    This might be because & will not get parsed in xml parser so enclosing evrything in CDATA.
    Need solution to remove CDATA and send the payload data as it is..

  • JTree XML Viewer

    Hi all
    i found this great article http://www.javalobby.org/java/forums/m91839339.html on Xml Viewer.
    But i dont understand how i can use it for JTreeTable because JTreeTable needs a TreeTableModel but
    i have a XMLTableModel .
    Anyone has used it?
    Thanks!!

    Hi all i try to modify the example that i find to make the tree editable but it not works...
    The main
    import java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.event.InputEvent;
    import java.awt.event.MouseEvent;
    import java.util.EventObject;
    import javax.swing.JScrollPane;
    public class MyTreeTable extends JTreeTable{
        public MyTreeTable(TreeTableModel treeTableModel){
            super(treeTableModel);
            setShowGrid(true);
            setGridColor(new Color(234, 234, 234));
            new TableColumnResizer(this);
           // setDefaultRenderer(XMLTreeTableModel.class, new  XMLTreeTableCellRenderer());
            setIntercellSpacing(new Dimension(1, 1));
        public boolean editCellAt(int row, int column, EventObject e){
            if(e instanceof MouseEvent){
                MouseEvent me = (MouseEvent)e;
                // If the modifiers are not 0 (or the left mouse button),
                // tree may try and toggle the selection, and table
                // will then try and toggle, resulting in the
                // selection remaining the same. To avoid this, we
                // only dispatch when the modifiers are 0 (or the left mouse
                // button).
                if(me.getModifiers()==0 ||
                        me.getModifiers()==InputEvent.BUTTON1_MASK){
                    for(int counter = getColumnCount()-1; counter>= 0;
                        counter--){
                        if(getColumnClass(counter)==TreeTableModel.class){
                            MouseEvent newME = new MouseEvent
                                    (tree, me.getID(),
                                            me.getWhen(), me.getModifiers(),
                                            me.getX()-getCellRect(0, counter, true).x,
                                            me.getY(), me.getClickCount(),
                                            me.isPopupTrigger());
                            tree.dispatchEvent(newME);
                            break;
                return false;
            return super.editCellAt(row, column, e);
        public void changeSelection(int row, int column, boolean toggle, boolean extend) {
            if(getCursor()==TableColumnResizer.resizeCursor)
                return;
            super.changeSelection(row, column, toggle, extend);
    }The editor
    import java.util.EventObject;
    import javax.swing.CellEditor;
    import javax.swing.event.CellEditorListener;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.EventListenerList;
    public class AbstractCellEditor implements CellEditor {
        protected EventListenerList listenerList = new EventListenerList();
        public Object getCellEditorValue() { return null; }
        public boolean isCellEditable(EventObject e) { return true; }
        public boolean shouldSelectCell(EventObject anEvent) { return false; }
        public boolean stopCellEditing() { return true; }
        public void cancelCellEditing() {}
        public void addCellEditorListener(CellEditorListener l) {
         listenerList.add(CellEditorListener.class, l);
        public void removeCellEditorListener(CellEditorListener l) {
         listenerList.remove(CellEditorListener.class, l);
         * Notify all listeners that have registered interest for
         * notification on this event type. 
         * @see EventListenerList
        protected void fireEditingStopped() {
         // Guaranteed to return a non-null array
         Object[] listeners = listenerList.getListenerList();
         // Process the listeners last to first, notifying
         // those that are interested in this event
         for (int i = listeners.length-2; i>=0; i-=2) {
             if (listeners==CellEditorListener.class) {
              ((CellEditorListener)listeners[i+1]).editingStopped(new ChangeEvent(this));
    * Notify all listeners that have registered interest for
    * notification on this event type.
    * @see EventListenerList
    protected void fireEditingCanceled() {
         // Guaranteed to return a non-null array
         Object[] listeners = listenerList.getListenerList();
         // Process the listeners last to first, notifying
         // those that are interested in this event
         for (int i = listeners.length-2; i>=0; i-=2) {
         if (listeners[i]==CellEditorListener.class) {
              ((CellEditorListener)listeners[i+1]).editingCanceled(new ChangeEvent(this));
    XML Parserimport javax.xml.parsers.SAXParser;
    import javax.xml.parsers.SAXParserFactory;
    import javax.xml.transform.OutputKeys;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMResult;
    import javax.xml.transform.sax.SAXSource;
    import org.w3c.dom.Document;
    import org.xml.sax.InputSource;
    import org.xml.sax.XMLReader;
    public class DOMUtil{
    public static Document createDocument(InputSource is) throws Exception{
    SAXParserFactory saxFactory = SAXParserFactory.newInstance();
    SAXParser parser = saxFactory.newSAXParser();
    XMLReader reader = new XMLTrimFilter(parser.getXMLReader());
    TransformerFactory factory = TransformerFactory.newInstance();
    Transformer transformer = factory.newTransformer();
    transformer.setOutputProperty(OutputKeys.INDENT, "no");
    DOMResult result = new DOMResult();
    transformer.transform(new SAXSource(reader, is), result);
    return (Document)result.getNode();
    } The treeimport java.awt.Color;
    import java.awt.Component;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Rectangle;
    import java.awt.event.InputEvent;
    import java.awt.event.MouseEvent;
    import java.util.EventObject;
    import javax.swing.DefaultCellEditor;
    import javax.swing.Icon;
    import javax.swing.JTable;
    import javax.swing.JTextField;
    import javax.swing.JTree;
    import javax.swing.ListSelectionModel;
    import javax.swing.LookAndFeel;
    import javax.swing.UIManager;
    import javax.swing.border.Border;
    import javax.swing.event.ListSelectionEvent;
    import javax.swing.event.ListSelectionListener;
    import javax.swing.table.TableCellRenderer;
    import javax.swing.tree.DefaultTreeCellRenderer;
    import javax.swing.tree.DefaultTreeSelectionModel;
    import javax.swing.tree.TreeCellRenderer;
    import javax.swing.tree.TreeModel;
    import javax.swing.tree.TreePath;
    public class JTreeTable extends JTable {
         /** A subclass of JTree. */
         protected TreeTableCellRenderer tree;
         public JTreeTable(TreeTableModel treeTableModel) {
              super();
              // Creates the tree. It will be used as a renderer and editor.
              tree = new TreeTableCellRenderer(treeTableModel);
              // Installs a tableModel representing the visible rows in the tree.
              super.setModel(new TreeTableModelAdapter(treeTableModel, tree));
              tree.setCellRenderer(new XMLTreeTableCellRenderer());
              // Forces the JTable and JTree to share their row selection models.
              ListToTreeSelectionModelWrapper selectionWrapper = new ListToTreeSelectionModelWrapper();
              tree.setSelectionModel(selectionWrapper);
              setSelectionModel(selectionWrapper.getListSelectionModel());
              // Installs the tree editor renderer and editor.
              setDefaultRenderer(TreeTableModel.class, tree);
              setDefaultEditor(TreeTableModel.class, new TreeTableCellEditor());
              // No grid.
              setShowGrid(false);
              // No intercell spacing
              setIntercellSpacing(new Dimension(0, 0));
              // And update the height of the trees row to match that of
              // the table.
              if (tree.getRowHeight() < 1) {
                   // Metal looks better like this.
                   setRowHeight(20);
         * Overridden to message super and forward the method to the tree. Since the
         * tree is not actually in the component hierarchy it will never receive
         * this unless we forward it in this manner.
         public void updateUI() {
              super.updateUI();
              if (tree != null) {
                   tree.updateUI();
                   // Do this so that the editor is referencing the current renderer
                   // from the tree. The renderer can potentially change each time
                   // laf changes.
                   setDefaultEditor(TreeTableModel.class, new TreeTableCellEditor());
              // Use the tree's default foreground and background colors in the
              // table.
              LookAndFeel.installColorsAndFont(this, "Tree.background",
                        "Tree.foreground", "Tree.font");
         * Workaround for BasicTableUI anomaly. Make sure the UI never tries to
         * resize the editor. The UI currently uses different techniques to paint
         * the renderers and editors; overriding setBounds() below is not the right
         * thing to do for an editor. Returning -1 for the editing row in this case,
         * ensures the editor is never painted.
         public int getEditingRow() {
              return (getColumnClass(editingColumn) == TreeTableModel.class) ? -1
                        : editingRow;
         * Returns the actual row that is editing as <code>getEditingRow</code>
         * will always return -1.
         private int realEditingRow() {
              return editingRow;
         * This is overridden to invoke super's implementation, and then, if the
         * receiver is editing a Tree column, the editor's bounds is reset. The
         * reason we have to do this is because JTable doesn't think the table is
         * being edited, as <code>getEditingRow</code> returns -1, and therefore
         * doesn't automatically resize the editor for us.
         public void sizeColumnsToFit(int resizingColumn) {
              super.sizeColumnsToFit(resizingColumn);
              if (getEditingColumn() != -1
                        && getColumnClass(editingColumn) == TreeTableModel.class) {
                   Rectangle cellRect = getCellRect(realEditingRow(),
                             getEditingColumn(), false);
                   Component component = getEditorComponent();
                   component.setBounds(cellRect);
                   component.validate();
         * Overridden to pass the new rowHeight to the tree.
         public void setRowHeight(int rowHeight) {
              super.setRowHeight(rowHeight);
              if (tree != null && tree.getRowHeight() != rowHeight) {
                   tree.setRowHeight(getRowHeight());
         * Returns the tree that is being shared between the model.
         public JTree getTree() {
              return tree;
         * Overridden to invoke repaint for the particular location if the column
         * contains the tree. This is done as the tree editor does not fill the
         * bounds of the cell, we need the renderer to paint the tree in the
         * background, and then draw the editor over it.
         public boolean editCellAt(int row, int column, EventObject e) {
              boolean retValue = super.editCellAt(row, column, e);
              if (retValue && getColumnClass(column) == TreeTableModel.class) {
                   repaint(getCellRect(row, column, false));
              return retValue;
         * A TreeCellRenderer that displays a JTree.
         public class TreeTableCellRenderer extends JTree implements
                   TableCellRenderer {
              /** Last table/tree row asked to renderer. */
              protected int visibleRow;
              * Border to draw around the tree, if this is non-null, it will be
              * painted.
              protected Border highlightBorder;
              public TreeTableCellRenderer(TreeModel model) {
                   super(model);
              * updateUI is overridden to set the colors of the Tree's renderer to
              * match that of the table.
              public void updateUI() {
                   super.updateUI();
                   // Make the tree's cell renderer use the table's cell selection
                   // colors.
                   TreeCellRenderer tcr = getCellRenderer();
                   if (tcr instanceof DefaultTreeCellRenderer) {
                        DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer) tcr);
                        // For 1.1 uncomment this, 1.2 has a bug that will cause an
                        // exception to be thrown if the border selection color is
                        // null.
                        // dtcr.setBorderSelectionColor(null);
                        dtcr.setTextSelectionColor(UIManager
                                  .getColor("Table.selectionForeground"));
                        dtcr.setBackgroundSelectionColor(UIManager
                                  .getColor("Table.selectionBackground"));
              * Sets the row height of the tree, and forwards the row height to the
              * table.
              public void setRowHeight(int rowHeight) {
                   if (rowHeight > 0) {
                        super.setRowHeight(rowHeight);
                        if (JTreeTable.this != null
                                  && JTreeTable.this.getRowHeight() != rowHeight) {
                             JTreeTable.this.setRowHeight(getRowHeight());
              * This is overridden to set the height to match that of the JTable.
              public void setBounds(int x, int y, int w, int h) {
                   super.setBounds(x, 0, w, JTreeTable.this.getHeight());
              * Sublcassed to translate the graphics such that the last visible row
              * will be drawn at 0,0.
              public void paint(Graphics g) {
                   g.translate(0, -visibleRow * getRowHeight());
                   super.paint(g);
                   // Draw the Table border if we have focus.
                   if (highlightBorder != null) {
                        highlightBorder.paintBorder(this, g, 0, visibleRow
                                  * getRowHeight(), getWidth(), getRowHeight());
              * TreeCellRenderer method. Overridden to update the visible row.
              public Component getTableCellRendererComponent(JTable table,
                        Object value, boolean isSelected, boolean hasFocus, int row,
                        int column) {
                   Color background;
                   Color foreground;
                   if (isSelected) {
                        background = table.getSelectionBackground();
                        foreground = table.getSelectionForeground();
                   } else {
                        background = table.getBackground();
                        foreground = table.getForeground();
                   highlightBorder = null;
                   if (realEditingRow() == row && getEditingColumn() == column) {
                        background = UIManager.getColor("Table.focusCellBackground");
                        foreground = UIManager.getColor("Table.focusCellForeground");
                   } else if (hasFocus) {
                        highlightBorder = UIManager
                                  .getBorder("Table.focusCellHighlightBorder");
                        if (isCellEditable(row, column)) {
                             background = UIManager
                                       .getColor("Table.focusCellBackground");
                             foreground = UIManager
                                       .getColor("Table.focusCellForeground");
                   visibleRow = row;
                   setBackground(background);
                   TreeCellRenderer tcr = getCellRenderer();
                   if (tcr instanceof DefaultTreeCellRenderer) {
                        DefaultTreeCellRenderer dtcr = ((DefaultTreeCellRenderer) tcr);
                        if (isSelected) {
                             dtcr.setTextSelectionColor(foreground);
                             dtcr.setBackgroundSelectionColor(background);
                        } else {
                             dtcr.setTextNonSelectionColor(foreground);
                             dtcr.setBackgroundNonSelectionColor(background);
                   return this;
         * An editor that can be used to edit the tree column. This extends
         * DefaultCellEditor and uses a JTextField (actually, TreeTableTextField) to
         * perform the actual editing.
         * <p>
         * To support editing of the tree column we can not make the tree editable.
         * The reason this doesn't work is that you can not use the same component
         * for editing and renderering. The table may have the need to paint cells,
         * while a cell is being edited. If the same component were used for the
         * rendering and editing the component would be moved around, and the
         * contents would change. When editing, this is undesirable, the contents of
         * the text field must stay the same, including the caret blinking, and
         * selections persisting. For this reason the editing is done via a
         * TableCellEditor.
         * <p>
         * Another interesting thing to be aware of is how tree positions its render
         * and editor. The render/editor is responsible for drawing the icon
         * indicating the type of node (leaf, branch...). The tree is responsible
         * for drawing any other indicators, perhaps an additional +/- sign, or
         * lines connecting the various nodes. So, the renderer is positioned based
         * on depth. On the other hand, table always makes its editor fill the
         * contents of the cell. To get the allusion that the table cell editor is
         * part of the tree, we don't want the table cell editor to fill the cell
         * bounds. We want it to be placed in the same manner as tree places it
         * editor, and have table message the tree to paint any decorations the tree
         * wants. Then, we would only have to worry about the editing part. The
         * approach taken here is to determine where tree would place the editor,
         * and to override the <code>reshape</code> method in the JTextField
         * component to nudge the textfield to the location tree would place it.
         * Since JTreeTable will paint the tree behind the editor everything should
         * just work. So, that is what we are doing here. Determining of the icon
         * position will only work if the TreeCellRenderer is an instance of
         * DefaultTreeCellRenderer. If you need custom TreeCellRenderers, that don't
         * descend from DefaultTreeCellRenderer, and you want to support editing in
         * JTreeTable, you will have to do something similiar.
         public class TreeTableCellEditor extends DefaultCellEditor {
              public TreeTableCellEditor() {
                   super(new TreeTableTextField());
              * Overridden to determine an offset that tree would place the editor
              * at. The offset is determined from the <code>getRowBounds</code>
              * JTree method, and additionally from the icon DefaultTreeCellRenderer
              * will use.
              * <p>
              * The offset is then set on the TreeTableTextField component created in
              * the constructor, and returned.
              public Component getTableCellEditorComponent(JTable table,
                        Object value, boolean isSelected, int r, int c) {
                   Component component = super.getTableCellEditorComponent(table,
                             value, isSelected, r, c);
                   JTree t = getTree();
                   boolean rv = t.isRootVisible();
                   int offsetRow = rv ? r : r - 1;
                   Rectangle bounds = t.getRowBounds(offsetRow);
                   int offset = bounds.x;
                   TreeCellRenderer tcr = t.getCellRenderer();
                   if (tcr instanceof DefaultTreeCellRenderer) {
                        Object node = t.getPathForRow(offsetRow).getLastPathComponent();
                        Icon icon;
                        if (t.getModel().isLeaf(node))
                             icon = ((DefaultTreeCellRenderer) tcr).getLeafIcon();
                        else if (tree.isExpanded(offsetRow))
                             icon = ((DefaultTreeCellRenderer) tcr).getOpenIcon();
                        else
                             icon = ((DefaultTreeCellRenderer) tcr).getClosedIcon();
                        if (icon != null) {
                             offset += ((DefaultTreeCellRenderer) tcr).getIconTextGap()
                                       + icon.getIconWidth();
                   ((TreeTableTextField) getComponent()).offset = offset;
                   return component;
              * This is overridden to forward the event to the tree. This will return
              * true if the click count >= 3, or the event is null.
              public boolean isCellEditable(EventObject e) {
                   if (e instanceof MouseEvent) {
                        MouseEvent me = (MouseEvent) e;
                        // If the modifiers are not 0 (or the left mouse button),
                        // tree may try and toggle the selection, and table
                        // will then try and toggle, resulting in the
                        // selection remaining the same. To avoid this, we
                        // only dispatch when the modifiers are 0 (or the left mouse
                        // button).
                        if (me.getModifiers() == 0
                                  || me.getModifiers() == InputEvent.BUTTON1_MASK) {
                             for (int counter = getColumnCount() - 1; counter >= 0; counter--) {
                                  if (getColumnClass(counter) == TreeTableModel.class) {
                                       MouseEvent newME = new MouseEvent(
                                                 JTreeTable.this.tree, me.getID(), me
                                                           .getWhen(), me.getModifiers(), me
                                                           .getX()
                                                           - getCellRect(0, counter, true).x,
                                                 me.getY(), me.getClickCount(), me
                                                           .isPopupTrigger());
                                       JTreeTable.this.tree.dispatchEvent(newME);
                                       break;
                        if (me.getClickCount() >= 3) {
                             return true;
                        return false;
                   if (e == null) {
                        return true;
                   return false;
         * Component used by TreeTableCellEditor. The only thing this does is to
         * override the <code>reshape</code> method, and to ALWAYS make the x
         * location be <code>offset</code>.
         static class TreeTableTextField extends JTextField {
              public int offset;
              public void reshape(int x, int y, int w, int h) {
                   int newX = Math.max(x, offset);
                   super.reshape(newX, y, w - (newX - x), h);
         * ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel to
         * listen for changes in the ListSelectionModel it maintains. Once a change
         * in the ListSelectionModel happens, the paths are updated in the
         * DefaultTreeSelectionModel.
         class ListToTreeSelectionModelWrapper extends DefaultTreeSelectionModel {
              /** Set to true when we are updating the ListSelectionModel. */
              protected boolean updatingListSelectionModel;
              public ListToTreeSelectionModelWrapper() {
                   super();
                   getListSelectionModel().addListSelectionListener(
                             createListSelectionListener());
              * Returns the list selection model. ListToTreeSelectionModelWrapper
              * listens for changes to this model and updates the selected paths
              * accordingly.
              ListSelectionModel getListSelectionModel() {
                   return listSelectionModel;
              * This is overridden to set <code>updatingListSelectionModel</code>
              * and message super. This is the only place DefaultTreeSelectionModel
              * alters the ListSelectionModel.
              public void resetRowSelection() {
                   if (!updatingListSelectionModel) {
                        updatingListSelectionModel = true;
                        try {
                             super.resetRowSelection();
                        } finally {
                             updatingListSelectionModel = false;
                   // Notice how we don't message super if
                   // updatingListSelectionModel is true. If
                   // updatingListSelectionModel is true, it implies the
                   // ListSelectionModel has already been updated and the
                   // paths are the only thing that needs to be updated.
              * Creates and returns an instance of ListSelectionHandler.
              protected ListSelectionListener createListSelectionListener() {
                   return new ListSelectionHandler();
              * If <code>updatingListSelectionModel</code> is false, this will
              * reset the selected paths from the selected rows in the list selection
              * model.
              protected void updateSelectedPathsFromSelectedRows() {
                   if (!updatingListSelectionModel) {
                        updatingListSelectionModel = true;
                        try {
                             // This is way expensive, ListSelectionModel needs an
                             // enumerator for iterating.
                             int min = listSelectionModel.getMinSelectionIndex();
                             int max = listSelectionModel.getMaxSelectionIndex();
                             clearSelection();
                             if (min != -1 && max != -1) {
                                  for (int counter = min; counter <= max; counter++) {
                                       if (listSelectionModel.isSelectedIndex(counter)) {
                                            TreePath selPath = tree.getPathForRow(counter);
                                            if (selPath != null) {
                                                 addSelectionPath(selPath);
                        } finally {
                             updatingListSelectionModel = false;
              * Class responsible for calling updateSelectedPathsFromSelectedRows
              * when the selection of the list changse.
              class ListSelectionHandler implements ListSelectionListener {
                   public void valueChanged(ListSelectionEvent e) {
                        updateSelectedPathsFromSelectedRows();
    The resizerimport java.awt.Container;
    import java.awt.Cursor;
    import java.awt.Dimension;
    import java.awt.Point;
    import java.awt.Rectangle;
    import java.awt.event.MouseEvent;
    import javax.swing.JScrollPane;
    import javax.swing.JTable;
    import javax.swing.JViewport;
    import javax.swing.event.MouseInputAdapter;
    import javax.swing.table.TableColumn;
    public class TableColumnResizer extends MouseInputAdapter{
    public static Cursor resizeCursor = Cursor.getPredefinedCursor(Cursor.E_RESIZE_CURSOR);
    private int mouseXOffset;
    private Cursor otherCursor = resizeCursor;
    private JTable table;
    public TableColumnResizer(JTable table){
    this.table = table;
    table.addMouseListener(this);
    table.addMouseMotionListener(this);
    private boolean canResize(TableColumn column){
    return column != null
    && table.getTableHeader().getResizingAllowed()
    && column.getResizable();
    private TableColumn getResizingColumn(Point p){
    return getResizingColumn(p, table.columnAtPoint(p));
    private TableColumn getResizingColumn(Point p, int column){
    if(column == -1){
    return null;
    int row = table.rowAtPoint(p);
    if(row==-1)
    return null;
    Rectangle r = table.getCellRect(row, column, true);
    r.grow( -3, 0);
    if(r.contains(p))
    return null;
    int midPoint = r.x + r.width / 2;
    int columnIndex;
    if(table.getTableHeader().getComponentOrientation().isLeftToRight())
    columnIndex = (p.x < midPoint) ? column - 1 : column;
    else
    columnIndex = (p.x < midPoint) ? column : column - 1;
    if(columnIndex == -1)
    return null;
    return table.getTableHeader().getColumnModel().getColumn(columnIndex);
    public void mousePressed(MouseEvent e){
    table.getTableHeader().setDraggedColumn(null);
    table.getTableHeader().setResizingColumn(null);
    table.getTableHeader().setDraggedDistance(0);
    Point p = e.getPoint();
    // First find which header cell was hit
    int index = table.columnAtPoint(p);
    if(index==-1)
    return;
    // The last 3 pixels + 3 pixels of next column are for resizing
    TableColumn resizingColumn = getResizingColumn(p, index);
    if(!canResize(resizingColumn))
    return;
    table.getTableHeader().setResizingColumn(resizingColumn);
    if(table.getTableHeader().getComponentOrientation().isLeftToRight())
    mouseXOffset = p.x - resizingColumn.getWidth();
    else
    mouseXOffset = p.x + resizingColumn.getWidth();
    private void swapCursor(){
    Cursor tmp = table.getCursor();
    table.setCursor(otherCursor);
    otherCursor = tmp;
    public void mouseMoved(MouseEvent e){
    if(canResize(getResizingColumn(e.getPoint()))
    != (table.getCursor() == resizeCursor)){
    swapCursor();
    public void mouseDragged(MouseEvent e){
    int mouseX = e.getX();
    TableColumn resizingColumn = table.getTableHeader().getResizingColumn();
    boolean headerLeftToRight =
    table.getTableHeader().getComponentOrientation().isLeftToRight();
    if(resizingColumn != null){
    int oldWidth = resizingColumn.getWidth();
    int newWidth;
    if(headerLeftToRight){
    newWidth = mouseX - mouseXOffset;
    } else{
    newWidth = mouseXOffset - mouseX;
    resizingColumn.setWidth(newWidth);
    Container container;
    if((table.getTableHeader().getParent() == null)
    || ((container = table.getTableHeader().getParent().getParent()) == null)
    || !(container instanceof JScrollPane)){
    return;
    if(!container.getComponentOrientation().isLeftToRight()
    && !headerLeftToRight){
    if(table != null){
    JViewport viewport = ((JScrollPane)container).getViewport();
    int viewportWidth = viewport.getWidth();
    int diff = newWidth - oldWidth;
    int newHeaderWidth = table.getWidth() + diff;
    /* Resize a table */
    Dimension tableSize = table.getSize();
    tableSize.width += diff;
    table.setSize(tableSize);
    * If this table is in AUTO_RESIZE_OFF mode and has a horizontal
    * scrollbar, we need to update a view's position.
    if((newHeaderWidth >= viewportWidth)
    && (table.getAutoResizeMode() == JTable.AUTO_RESIZE_OFF)){
    Point p = viewport.getViewPosition();
    p.x =
    Math.max(0, Math.min(newHeaderWidth - viewportWidth, p.x + diff));
    viewport.setViewPosition(p);
    /* Update the original X offset value. */
    mouseXOffset += diff;
    public void mouseReleased(MouseEvent e){
    table.getTableHeader().setResizingColumn(null);
    table.getTableHeader().setDraggedColumn(null);
    The mainimport java.awt.event.WindowAdapter;
    import java.awt.event.WindowEvent;
    import java.io.FileInputStream;
    import java.io.InputStream;
    import javax.swing.JFrame;
    import javax.swing.JScrollPane;
    import org.xml.sax.InputSource;
    public class TreeTableExample0 {
         public static void main(String[] args) throws Exception {
              new TreeTableExample0();
         public TreeTableExample0() throws Exception {
              JFrame frame = new JFrame("TreeTable");
              InputStream inputStream = new FileInputStream("c:\\totali.xml");
              InputSource inputSource = new InputSource(inputStream);
              MyTreeTable treeTable = new MyTreeTable(new XMLTreeTableModel(DOMUtil
                        .createDocument(inputSource)));
              frame.addWindowListener(new WindowAdapter() {
                   public void windowClosing(WindowEvent we) {
                        System.exit(0);
              frame.getContentPane().add(new JScrollPane(treeTable));
              frame.pack();
              frame.show();
    The modelimport javax.swing.tree.TreeModel;
    public interface TreeTableModel extends TreeModel
    * Returns the number of available columns.
    public int getColumnCount();
    * Returns the name for column number <code>column</code>.
    public String getColumnName(int column);
    * Returns the type for column number <code>column</code>.
    public Class getColumnClass(int column);
    * Returns the value to be displayed for node <code>node</code>,
    * at column number <code>column</code>.
    public Object getValueAt(Object node

  • BI Publisher Report Build - XML view

    Hi Experts,
    I am trying to build the BI publisher report. During the process, I am defining the SQL query structure in the 'Query Builder' once after that I have saved the report.
    As part of the next step , I have clicked on 'view' link to view the report structure as mentioned in the OBE.
    I could only see the 'Data' view but not the 'XML' view. Is there any way I can see the 'XML' view.
    Any help would be appreciated
    Siva

    Data means look at the xml data that you have created.

  • Binding Data from OfflineStore to List in XML view

    Hi Experts,
    I am developing an application using SAP WebIDE. While loading a page, I want to read some data from an offlineStore and show it in a listview.
    Following is my code for xml view:
    <sap.ui.core.mvc:View xmlns="sap.m" xmlns:sap.ui.core="sap.ui.core" xmlns:sap.ui.core.mvc="sap.ui.core.mvc" controllerName="com.arteria.view.CustomerList">
        <Page title="Customers" showNavButton="true">
       </Page>
    </sap.ui.core.mvc:View>
    And my js code is as follows:
    onInit: function() {
      this.getView().addEventDelegate({
       onBeforeShow: function(evt) {
        sap.ui.getCore().byId("idCustomerList").getController().read();
    read:function() {
                    oList = new sap.m.List();
                    oList.removeAllItems();
                    var uri = window.localStorage.getItem("ApplicationEndpointURL");
                    var user = window.localStorage.getItem("User");
                    var password = window.localStorage.getItem("Password");
                    var headers = { "X-SMP-APPCID" : window.localStorage.getItem("ApplicationConnectionId") };
                    // Create OData model from URL
                    var oModel = new sap.ui.model.odata.ODataModel(uri, true, user, password, headers);
                    var iOS = (navigator.userAgent.match(/(iPad|iPhone|iPod)/g) ? true : false );
                    if (iOS) {
                        oModel = new sap.ui.model.odata.ODataModel(uri, true, user, password, headers);
                    var oTemplate = new sap.m.StandardListItem({
                                                               title: "{CustomerNumber}", description: "{CustomerName}", tap:"handleProductListItemPress", type:"Navigation"    
                    oList.setModel(oModel);
                    oList.bindItems("/Customers", oTemplate, null, null);
                    var custListPage = sap.ui.getCore().byId("idCustomerList");
                    custListPage.addCustomData(oList);
       handleProductListItemPress: function(oEvent) {
            sap.ui.getCore().getEventBus().publish("nav", "to", {
                id : "idCustomerDetail",
                context: oEvent.getSource().getBindingContext()
    The problem is I am getting a blank page. The list is not getting attached to the page.
    Waiting for your reply.
    Regards,
    Dhani

    why not move List definitiaon to XML 
    <sap.ui.core.mvc:View xmlns="sap.m" xmlns:sap.ui.core="sap.ui.core" xmlns:sap.ui.core.mvc="sap.ui.core.mvc" controllerName="com.arteria.view.CustomerList"> 
        <Page title="Customers" showNavButton="true"> 
    <List id="CustomerList"/>
       </Page> 
    </sap.ui.core.mvc:View> 
    so
    oList = this.byId("CustomerList");
    oList.setModel(oModel); 
                    oList.bindItems("/Customers", oTemplate, null, null); 
                    var custListPage = sap.ui.getCore().byId("idCustomerList"); 
                    custListPage.addCustomData(oList); 

  • Generating XML Using JAVA

    How to generate XML usng java without using following.
    import org.apache.xerces.dom.DocumentImpl;
    import org.apache.xml.serialize.OutputFormat;
    import org.apache.xml.serialize.XMLSerializer;
    XML to be generated is as follows.
    <?xml version="1.0" encoding="UTF-8"?>
    <Modi xmlns:xsi="Modi/Modi1">
    <docConfig>
    <className>PO</className>
    <classDesc>Purchase</classDesc>
    <create>Y</create>
    </docConfig>
    <indexConfig>
    <index sequence="1">
    <shortName>PODATE</shortName>
    <displayName>PO Date</displayName>
    <type>date</type>
    <length>10</length>
    </index>
    </indexConfig>
    </upload>

    Two answers.
    If you want to not use any of the XML-oriented classes, you can use a PrintWriter. Just code:
    PrintWriter pw = new PrinteWriter(whatever);
    pw.println( "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" );
    etc.If you want to use XML-oriented classes, but just not these 3 (can't imagine why), then use
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerFactory;
    instead of XMLSerializer and OutputFormat, and
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    instead of the DocumentImpl
    Dave Patterson

  • Dynamic binding of items in sap.m.Table using XML views

    Dear SAPUI5 guru's,
    Let's start by saying I'm an ABAP developer who's exploring SAPUI5, so I'm still a rookie at the time of writing. I challenged myself by developing a simple UI5 app that shows information about my colleagues like name, a pic, address data and their skills. The app uses the sap.m library and most of the views are XML based which I prefer.
    The data is stored on an ABAP system and exposed via a gateway service. This service has 2 entities: Employee and Skill. Each employee can have 0..n skills and association/navigation between these 2 entities is set up correctly in the service. The data of this service is fetched from within the app using a sap.ui.model.odata.ODataModel model.
    The app uses the splitApp control which shows the list of employees on the left side (master view). If a user taps an employee, the corresponding details of the employee entity are shown on the right (detail view).
    Up till here everything is fine but I've been struggling with my latest requirement which is: show the skills of the selected employee in a separate XML view when the user performs an action (for the time being, I just created a button on the detail view to perform the action). After some hours I actually got it working but I doubt if my solution is the right way to go. And that's why I'm asking for your opinion here.
    Let's explain how I got things working. First of all I created a new XML view called 'Skills'. The content on this view is currently just a Table with 2 columns:
    <core:View xmlns:core="sap.ui.core" xmlns:mvc="sap.ui.core.mvc" xmlns="sap.m"
      controllerName="com.pyramid.Skills" xmlns:html="http://www.w3.org/1999/xhtml">
      <Page title="Skills"
           showNavButton="true"
           navButtonPress="handleNavButtonPress">
      <content>
      <Table
       id="skillsTable">
      <columns>
      <Column>
      <Label text="Name"/>
      </Column>
      <Column>
      <Label text="Rating"/>
      </Column>
      </columns>
      </Table>
      </content>
      </Page>
    </core:View>
    The button on the Detail view calls function showSkills:
    showSkills: function(evt) {
      var context = evt.getSource().getBindingContext();
      this.nav.to("Skills", context);
      var skillsController = this.nav.getView().app.getPage("Skills").getController();
      skillsController.updateTableBinding();
    Within 'this.nav.to("Skills", context);' I add the Skills view to the splitApp and set its bindingContext to the current binding context (e.g. "EmployeeSet('000001')"). Then I call function updateTableBinding in the controller of the Skills view which dynamically binds the items in the table based on the selected employee. So, when the ID of the selected employee is '000001', the path of the table's item binding should be "/EmployeeSet('000001')/Skills"
    updateTableBinding: function(){
      var oTemplate = new sap.m.ColumnListItem(
      {cells: [
              new sap.m.Text({text : "{Name}"}),
              new sap.m.Text({text : "{Rating}"})
      var oView = this.getView();
      var oTable = oView.byId("skillsTable");
      var oContext = oView.getBindingContext();
      var path = oContext.sPath + "/Skills";
      oTable.bindItems(path, oTemplate);
    Allthough it works fine, this is where I have my first doubt. Is this the correct way to bind the items? I tried to change the context that is passed to this.nav.to and wanted it to 'drill-down' one level, from Employee to Skills, but I couldn't manage to do that.
    I also tried to bind using the items aggregation of the table within the XML declaration (<Table id="skillsTable" items="{/EmployeeSet('000001')/Skills}">). This works fine if I hard-code the employee ID but off course this ID needs to be dynamic.
    Any better suggestions?
    The second doubt is about the template parameter passed to the bindItems method. This template is declared in the controller via javascript. But I'm using XML views! So why should I declare any content in javascript?? I tried to declare the template in the XML view itself by adding an items tag with a ColumnListItem that has an ID:
                    <items>
                        <ColumnListItem
                        id="defaultItem">
                        <cells>
                            <Text text="{Name}"/>
                            </cells>
                            <cells>
                            <Text text="{Rating}"/>
                            </cells>
                        </ColumnListItem>
                    </items>
    Then, in the updateTableBinding function, I fetched this control (by ID), and passed it as the template parameter to the bindItems method. In this case the table shows a few lines but they don't contain any data and their height is only like 1 mm! Does anyone know where this strange behaviour comes from or what I'm doing wrong?
    I hope I explained my doubts clearly enough. If not, let me know which additional info is required.
    Looking forward to your opinions/suggestions,
    Rudy Clement.

    Hi everybody,
    I found this post by searching for a dynamic binding for well acutally not the same situation but it's similar to it. I'm trying to do the following. I'm having a list where you can create an order. On the bottom of the page you'll find a button with which you're able to create another order. All the fields are set to the same data binding ... so the problem is if you've filled in the values for the first order and you'll press the button you'll get the same values in the second order. Is it possible to generate a dynamic binding?
    I'm going to post you a short code of what I'm meaning:
    <Input type="Text" value="{path: 'MyModel>/Order/0/Field1'}" id="field1">
         <layoutData>
                    <l:GridData span="L11 M7 S3"></l:GridData>
               </layoutData>
    </Input>
    As you can see I need to set the point of "0" to a dynamic number. Is there any possibility to reach this???
    Hope you can help
    Greetings
    Stef

  • Passing parameter to the i18n text from xml view in fiori app

    Hi,
    Could somebody let me know how to pass parameter to get the i18n text inside xml view of a Fiori app.
    For e.g. inside my i18n properties file i have a entry like:
    PEC_ISSUE={0}issues of total{1}
    inside xml i use it like {i18n>PEC_ISSUE}
    but now how do i pass those 2 parameters to this ??
    i know in javascript it works with , (comma) but does not work in xml. Any help...
    Thanks,
    Ashish

    Hi Michele,
    I found it. Below is the example from my coding.
    <Text      text="{parts: [{path: 'i18n>PEC_to'}, {path: 'promoprocsteps>RetailPromotionSalesFromDate_E'},
                                                           {path:'promoprocsteps>RetailPromotionSalesToDate_E'}],
                                                           formatter: 'retail.promn.promotioncockpit.utils.Formatter.formatDatesString'}"  />
    So you have to create a formatter and pass all the strings to the formatter and then do it inside JS.
    In JS you do it in this way:
    i18n.getText(i18String, [newString, string2]);
    i hope this helps.
    Regards,
    Ashish

  • In XML view, how to set sap.ui.core.CSSSize array for property "widths" of MatrixLayout Control?

    As SAPUI5 prefer XML views, I'm rewriting JS view into XML views.
    When I translate the statements below, I can not set sap.ui.core.CSSSize array for property "widths" of Control MatrixLayout.
    JS version:
    var oLayout = new sap.ui.commons.layout.MatrixLayout({
        id : 'matrix3'
        columns : 3,
        width : '600px',
        widths : ['100px', '200px', '300px']
    XML version:
    <l:MatrixLayout
        id="matrix3"
        columns="3"
        width="600px"
        widths="['100px', '200px', '300px']">
    <l:MatrixLayout>
    The error says: Uncaught Error: "[100px, 200px, 300px]" is of type object, expected sap.ui.core.CSSSize[] for property "widths" of Element sap.ui.commons.layout.MatrixLayout.
    Same problem with property `backgroundDesign` of MatrixLayoutCell, I can only use a workaround to use String "Fill1" not the Class "sap.ui.commons.layout.BackgroundDesign.Fill1".
    When we meet a property which need a Class object as value, we can not set it in String Format for XML views. That's a pity or I did not find the right way to set NON-String values as property for XML Controls.

    Hi,
    any settings that are not possible in the XML, need to be set in the controller instead.
    Using the string value of an enum is fine, though.
    Regards
    Andreas

  • How to get previous tag name from a xml in java

    Hai
          I need to get the previous tag name from a xml in java.
         I got the current tagname , i need to get the previous tagname
        NodeList parentactionList = lParentRule.getElementsByTagName(
    "parentactiondetails");
    i use this way of getting the the current tag name, i need to get the previous tag name ie.. before "parentactiondetails"
    for sample
    </parentruledetails>
    </Parentrule>
    </SingleParentRule>
    <parentactiondetails ACTION_FLAG="RulePass" PARENT_RULE_CODE="PR626"/>
    <ParentCompliance>
    i have xml like this i am getting the "parentactiondetails " ...  now i need to get the previous tag name </SingleParentRule> in java
    Can any one help me,

    still i am not able to get the correct value...
    i used the way wat u said it is not even going inside the if condition
    below is my actual xml as before i asked i need the before tag name of <parentactiondetails>
    ie  the closing tag of </Singleparentrule>
    i have attached the xml also
    pl reply me as soon as possible
    <?xml version="1.0" encoding="UTF-8"?>
    <GRC>
    <ParentInventory>
    <Vendor comment="" createdBy="root" vendorCode="1001" vendorName="Cisco">
    <DeviceType createdBy="root" devTypeCode="1001" devTypeName="Router" vendorCode="1001">
    <Series createdBy="root" devTypeCode="1002" seriesCode="1110" seriesName="2800" vendorCode="1001">
    <Model createdBy="root" devTypeCode="1002" modelCode="1459" modelName="4506" seriesCode="1110" vendorCode="1001">
    <Sub createdBy="root" devTypeCode="1002" modelCode="1459" seriesCode="1110" subCode="1695" subName="CAT4500-SUP4" vendorCode="1001">
    <CodeVersion createdBy="root" devTypeCode="1002" modelCode="1459" seriesCode="1110" startCode="2207" startName="12.2(25)EWA2" subCode="1695" vendorCode="1001">
    <ImageName createdBy="root" devTypeCode="1002" endCode="5508" endName="Standard" modelCode="1459" seriesCode="1110" startCode="2207" subCode="1695" vendorCode="1001"/>
    </CodeVersion>
    <CodeVersion createdBy="root" devTypeCode="1002" modelCode="1459" seriesCode="1110" startCode="2225" startName="12.2(5)T" subCode="1695" vendorCode="1001"/>
    </Sub>
    </Model>
    </Series>
    </DeviceType>
    </Vendor>
    </ParentInventory>
    <Parentrule>
    <parentruledetails COMMENTS="1PARENT_RULEFILT_AUDITPASS" CREATED_BY="root" DEVICE_LEVEL_FLAG="Configuration" PARENT_RULE_CODE="PR626" PARENT_RULE_TYPE="SPR_AP" RULE_NAME="1PARENT_RULEFILT_AUDITPASS">
    <parentscope DEVICE_TYPE_NAME="Switch" END_CODE_VERNAME="Standard" MODEL_NAME="3750-24PS" PARENT_RULE_CODE="PR626" SERIES_NAME="3750" ST_CODE_VERNAME="12.2(25)SEE2" SUP_CPU_NAME="3750" VENDOR_NAME="Cisco"/>
    <parentmultiscope COLUMN_INDEX="0" DEVICE_TYPE_NAME="Switch" END_CODE_VERNAME="Standard" MODEL_NAME="3750-24PS" MULTI_SCOPE_CODE="{1=1001~1002~ 1010~ 1131~ 1190~ 2041~E~5255}" MULTI_SCOPE_NAME="{1=Cisco~Switch~3750~3750-24PS~3750~12.2(25)SEE2~E~Standard}" OPERATOR="E" PARENT_RULE_CODE="PR626" SERIES_NAME="3750" ST_CODE_VERNAME="12.2(25)SEE2" SUP_CPU_NAME="3750" VENDOR_NAME="Cisco"/>
    <SingleParentRule CHILD_TYPE="ALL" COLUMN_INDEX="0" FILT_CONDN="PA" PARENT_RULE_CODE="PR626" RULE_CODE="PR625[AND]," RULE_TYPE_FLAG="singleparentrule">
    <Parentrule>
    <parentruledetails COMMENTS="1CUSTRULE_PARENT_CROSSREF_FAIL" CREATED_BY="root" DEVICE_LEVEL_FLAG="Configuration" PARENT_RULE_CODE="PR625" PARENT_RULE_TYPE="PCR_CR" RULE_NAME="1CUSTRULE_PARENT_CROSSREF_FAIL">
    <parentscope DEVICE_TYPE_NAME="Switch" END_CODE_VERNAME="Standard" MODEL_NAME="3750-24PS" PARENT_RULE_CODE="PR625" SERIES_NAME="3750" ST_CODE_VERNAME="12.2(25)SEE2" SUP_CPU_NAME="3750" VENDOR_NAME="Cisco"/>
    <parentmultiscope COLUMN_INDEX="0" DEVICE_TYPE_NAME="Switch" END_CODE_VERNAME="Standard" MODEL_NAME="3750-24PS" MULTI_SCOPE_CODE="{1=1001~1002~ 1010~ 1131~ 1190~ 2041~E~5255}" MULTI_SCOPE_NAME="{1=Cisco~Switch~3750~3750-24PS~3750~12.2(25)SEE2~E~Standard}" OPERATOR="E" PARENT_RULE_CODE="PR625" SERIES_NAME="3750" ST_CODE_VERNAME="12.2(25)SEE2" SUP_CPU_NAME="3750" VENDOR_NAME="Cisco"/>
    <ParentCommand>
    <Command ChildType="Console" cmdCode="37135" cmdName="login authentication &lt;string&gt;"/>
    </ParentCommand>
    <parentcustomdetails CHILD_TYPE="Console" CMD_CODE="37135" CMD_NAME="login authentication [string]" CMD_OPTION="login authentication " COLUMN_INDEX="0" CONDN_OPER="exists" CONDN_VALUE="True" PARENT_RULE_CODE="PR625" RULE_TYPE_FLAG="Customrule"/>
    <parentcustomdetails CHILD_TYPE="Console" CMD_CODE="37135" CMD_NAME="login authentication [string]" CMD_OPTION="string" COLUMN_INDEX="1" CONDN_OPER="equalsto" CONDN_VALUE="cisco" PARENT_RULE_CODE="PR625" RULE_TYPE_FLAG="Customrule"/>
    <parentcustomconsole CHILD_TYPE="Console" CONSOLE_NUM="Any" PARENT_RULE_CODE="PR625"/>
    <parentactiondetails ACTION_FLAG="CrossRef" PARENT_RULE_CODE="PR625"/>
    <parentcrossrefdetails ACTION_FLAG="CrossRef" CHILD_TYPE="Console" CMD_CODE="37135" CMD_NAME="login authentication [string]" CMD_OPTION="login authentication " COLUMN_INDEX="0" CONDN_OPER="exists" CONDN_VALUE="True" PARENT_RULE_CODE="PR625"/>
    <parentcrossrefdetails ACTION_FLAG="CrossRef" CHILD_TYPE="Console" CMD_CODE="37135" CMD_NAME="login authentication [string]" CMD_OPTION="string" COLUMN_INDEX="1" CONDN_OPER="equalsto" CONDN_VALUE="AAAAAA" PARENT_RULE_CODE="PR625"/>
    <parentcrossrefconsole ACTION_FLAG="CrossRef" CHILD_TYPE="Console" CONSOLE_NUM="Any" PARENT_RULE_CODE="PR625"/>
    <ParentCompliance>
    <PRComp comments="Group Policy is an important and useful addition to your Active Directory deployment. Managing your internal network and ensuring compliance .Group Policies are a set of &quot;rules&quot; that are applied to different parts of a Windows-based network" compCode="1006" compName="INTERNAL GROUP POLICY" createdBy="root" url="http://www.INTERNAL GROUP POLICY.com"/>
    <PRComp comments="This is the compliance for the department of Security agency" compCode="1012" compName="DISA" createdBy="root" url="http://iase.disa.mil/stigs/checklist/"/>
    <PRComp comments="This is the compliance from the National Security Agency" compCode="1013" compName="NSA" createdBy="root" url="http://checklists.nist.gov/chklst_detail.cfm?confi"/>
    <PRComp comments="he Center for Internet Security (CIS) is a not-for-profit organization that helps enterprises reduce the risk of business and e-commerce disruptions resulting from inadequate technical security controls, and provides enterprises with resources for measuring information security status and making rational security investment decisions" compCode="1020" compName="CIS" createdBy="root" url="http://www.cisecurity.org/"/>
    <PRComp comments="This is a Cisco document. It outlines the key security elements identified for Network Security Baseline, along with implementation guidelines to assist in their design, integration, and deployment in production networks. " compCode="1022" compName="Cisco Secuirty Baseline" createdBy="root" url="http://www.cisco.com/en/US/docs/solutions/Enterpri"/>
    <PRComp comments="This is the best practices from industry experts to help make audit recommendations in a customers environment. " compCode="1023" compName="360 GRC Best Practice" createdBy="root" url="http://www.360grc.com"/>
    </ParentCompliance>
    <parentriskrecommendationdetails ACTION_FLAG="CrossRef" AUDIT_RESULTS="Both_pass_fail_result" CHILD_TYPE="ALL" CMD_CODE="fdg" COMMAND_REF="dfs" DEFINITION="dfgd" DEVICE_RECOM_CATEGORY_CODE="IP - Addressing Services" DEVICE_RISK_CATEGORY_CODE="IP - Addressing Services" DISP_LEVEL="Parent and child result" PARENT_RULE_CODE="PR625" RATING1="2" RATING1_NAME="DISA" RATING2="2" RATING2_NAME="NSA" RATING3="2" RATING3_NAME="Cisco Secuirty Baseline" RATING4="2" RATING4_NAME="CIS" RATING5="2" RATING5_NAME="360 GRC Best Practice" RATING6="2" RATING6_NAME="INTERNAL GROUP POLICY" RATING_IMPACT="Low" RATING_PRIORITY="Low" RATING_URGENCY="Low" RECOMENDATION="ss" WEB_REF="sfs" WEIGHTING1="10" WEIGHTING1_NAME="DISA" WEIGHTING2="10" WEIGHTING2_NAME="NSA" WEIGHTING3="10" WEIGHTING3_NAME="Cisco Secuirty Baseline" WEIGHTING4="10" WEIGHTING4_NAME="CIS" WEIGHTING5="10" WEIGHTING5_NAME="360 GRC Best Practice" WEIGHTING6="10" WEIGHTING6_NAME="INTERNAL GROUP POLICY"/>
    </parentruledetails>
    </Parentrule>
    </SingleParentRule>
    <parentactiondetails ACTION_FLAG="RulePass" PARENT_RULE_CODE="PR626"/>
    <ParentCompliance>
    <PRComp comments="Group Policy is an important and useful addition to your Active Directory deployment. Managing your internal network and ensuring compliance .Group Policies are a set of &quot;rules&quot; that are applied to different parts of a Windows-based network" compCode="1006" compName="INTERNAL GROUP POLICY" createdBy="root" url="http://www.INTERNAL GROUP POLICY.com"/>
    <PRComp comments="This is the compliance for the department of Security agency" compCode="1012" compName="DISA" createdBy="root" url="http://iase.disa.mil/stigs/checklist/"/>
    <PRComp comments="This is the compliance from the National Security Agency" compCode="1013" compName="NSA" createdBy="root" url="http://checklists.nist.gov/chklst_detail.cfm?confi"/>
    <PRComp comments="he Center for Internet Security (CIS) is a not-for-profit organization that helps enterprises reduce the risk of business and e-commerce disruptions resulting from inadequate technical security controls, and provides enterprises with resources for measuring information security status and making rational security investment decisions" compCode="1020" compName="CIS" createdBy="root" url="http://www.cisecurity.org/"/>
    <PRComp comments="This is a Cisco document. It outlines the key security elements identified for Network Security Baseline, along with implementation guidelines to assist in their design, integration, and deployment in production networks. " compCode="1022" compName="Cisco Secuirty Baseline" createdBy="root" url="http://www.cisco.com/en/US/docs/solutions/Enterpri"/>
    <PRComp comments="This is the best practices from industry experts to help make audit recommendations in a customers environment. " compCode="1023" compName="360 GRC Best Practice" createdBy="root" url="http://www.360grc.com"/>
    </ParentCompliance>
    <parentriskrecommendationdetails ACTION_FLAG="RulePass" AUDIT_RESULTS="Both_pass_fail_result" CHILD_TYPE="ALL" CMD_CODE="dfg" COMMAND_REF="dfgdf" DEFINITION="dfgdf" DEVICE_RECOM_CATEGORY_CODE="IP - Addressing Services" DEVICE_RISK_CATEGORY_CODE="IP - Addressing Services" DISP_LEVEL="Parent and child result" PARENT_RULE_CODE="PR626" RATING1="3" RATING1_NAME="DISA" RATING2="3" RATING2_NAME="NSA" RATING3="3" RATING3_NAME="Cisco Secuirty Baseline" RATING4="3" RATING4_NAME="CIS" RATING5="3" RATING5_NAME="360 GRC Best Practice" RATING6="3" RATING6_NAME="INTERNAL GROUP POLICY" RATING_IMPACT="Low" RATING_PRIORITY="Low" RATING_URGENCY="Low" RECOMENDATION="dfgdf" WEB_REF="dfgdf" WEIGHTING1="10" WEIGHTING1_NAME="DISA" WEIGHTING2="10" WEIGHTING2_NAME="NSA" WEIGHTING3="10" WEIGHTING3_NAME="Cisco Secuirty Baseline" WEIGHTING4="10" WEIGHTING4_NAME="CIS" WEIGHTING5="10" WEIGHTING5_NAME="360 GRC Best Practice" WEIGHTING6="10" WEIGHTING6_NAME="INTERNAL GROUP POLICY"/>
    </parentruledetails>
    </Parentrule>
    </GRC>

  • How to parse XML to Java object... please help really stuck

    Thank you for reading this email...
    If I have a **DTD** like:
    <!ELEMENT person (name, age)>
    <!ATTLIST person
         id ID #REQUIRED
    >
    <!ELEMENT name ((family, given) | (given, family))>
    <!ELEMENT age (#PCDATA)>
    <!ELEMENT family (#PCDATA)>
    <!ELEMENT given (#PCDATA)>
    the **XML** like:
    <person id="a1">
    <name>
         <family> Yoshi </family>
         <given> Samurai </given>
    </name>
    <age> 21 </age>
    </person>
    **** Could you help me to write a simple parser to parse my DTD and XML to Java object, and how can I use those objects... sorry if the problem is too basic, I am a beginner and very stuck... I am very confuse with SAXParserFactory, SAXParser, ParserAdapter and DOM has its own Factory and Parser, so confuse...
    Thank you for your help, Yo

    Hi, Yo,
    Thank you very much for your help. And I Wish you are there...I'm. And I plan to stay - It's sunny and warm here in Honolulu and the waves are up :)
    A bit more question for dear people:
    In the notes, it's mainly focus on JAXB,
    1. Is that mean JAXB is most popular parser for
    parsing XML into Java object? With me, definitely. There are essentially 3 technologies that allow you to parse XML documents:
    1) "Callbacks" (e.g. SAX in JAXP): You write a class that overrides 3 methods that will be called i) whenever the parser encounters a start tag, ii) an end tag, or iii) PCDATA. Drawback: You have to figure out where the heck in the document hierarchy you are when such a callback happens, because the same method is called on EACH start tag and similarly for the end tag and the PCDATA. You have to create the objects and put them into your own data structure - it's very tedious, but you have complete control. (Well, more or less.)
    2) "Tree" (e.g. DOM in JAXP, or it's better cousin JDOM): You call a parser that in one swoop creates an entire hierarchy that corresponds to the XML document. You don't get called on each tag as with SAX, you just get the root of the resulting tree. Drawback: All the nodes in the tree have the same type! You probably want to know which tags are in the document, don't you? Well, you'll have to traverse the tree and ask each node: What tag do you represent? And what are your attributes? (You get only strings in response even though your attributes often represent numbers.) Unless you want to display the tree - that's a nice application, you can do it as a tree model for JTree -, or otherwise don't care about the individual tags, DOM is not of much help, because you have to keep track where in the tree you are while you traverse it.
    3) Enter JAXB (or Castor, or ...): You give it a grammar of the XML documents you want to parse, or "unmarshall" as the fashion dictates to call it. (Actually the name isn't that bad, because "parsing" focuses on the input text while "unmarshalling" focuses on the objects you get, even though I'd reason that it should be marshalling that converts into objects and unmarshalling that converts objects to something else, and not vice versa but that's just my opinion.) The JAXB compiler creates a bunch of source files each with one (or now more) class(es) (and now interfaces) that correspond to the elements/tags of your grammar. (Now "compiler" is a true jevel of a misnomer, try to explain to students that after they run the "compiler", they still need to compile the sources the "compiler" generated with the real Java compiler!). Ok, you've got these sources compiled. Now you call one single method, unmarshall() and as a result you get the root node of the hierarchy that corresponds to the XML document. Sounds like DOM, but it's much better - the objects in the resulting tree don't have all the same type, but their type depends on the tag they represent. E.g if there is the tag <ball-game> then there will be an object of type myPackage.BallGame in your data structure. It gets better, if there is <score> inside <ball-game> and you have an object ballGame (of type BallGame) that you can simply call ballGame.getScore() and you get an object of type myPackage.Score. In other words, the child tags become properties of the parent object. Even better, the attributes become properties, too, so as far as your program is concerned there is no difference whether the property value was originally a tag or an attribute. On top of that, you can tell in your schema that the property has an int value - or another primitive type (that's like that in 1.0, in the early release you'll have to do it in the additional xjs file). So this is a very natural way to explore the data structure of the XML document. Of course there are drawbacks, but they are minor: daunting complexity and, as a consequence, very steep learning curve, documentation that leaves much to reader's phantasy - read trial and error - (the user's guide is too simplicistic and the examples too primitive, e.g. they don't even tell you how to make a schema where a tag has only attributes) and reference manual that has ~200 pages full of technicalities and you have to look with magnifying glas for the really usefull stuff, huge number of generated classes, some of which you may not need at all (and in 1.0 the number has doubled because each class has an accompanying interface), etc., etc. But overall, all that pales compared to the drastically improved efficiency of the programmer's efforts, i.e. your time. The time you'll spend learning the intricacies is well spent, you'll learn it once and then it will shorten your programming time all the time you use it. It's like C and Java, Java is order of magnitude more complex, but you'd probably never be sorry you gave up C.
    Of course the above essay leaves out lots and lots of detail, but I think that it touches the most important points.
    A word about JAXB 1.0 vs. Early Release (EA) version. If you have time, definitively learn 1.0, they are quite different and the main advantage is that the schema combines all the info that you had to formulate in the DTD and in the xjs file when using the EA version. I suggested EA was because you had a DTD already, but in retrospect, you better start from scratch with 1.0. The concepts in 1.0 are here to stay and once your surmounted the learning curve, you'll be glad that you don't have to switch concepts.
    When parser job is done,
    what kind of Java Object we will get? (String,
    InputStream or ...)See above, typically it's an object whose type is defined as a class (and interface in 1.0) within the sources that JABX generates. Or it can be a String or one of the primitive types - you tell the "compiler" in the schema (xjs file in EA) what you want!
    2. If we want to use JAXB, we have to contain a
    XJS-file? Something like:In EA, yes. In 1.0 no - it's all in the schema.
    I am very new to XML, is there any simpler way to get
    around them? It has already take me 4 days to find a
    simple parser which give it XML and DTD, then return
    to me Java objects ... I mean if that kind of parser
    exists....It'll take you probably magnitude longer that that to get really familiar with JAXB, but believe me it's worth it. You'll save countless days if not weeks once you'll start developing serious software with it. How long did it take you to learn Java and it's main APIs? You'll either invest the time learning how to use the software others have written, or you invest it writing it yourself. I'll take the former any time. But it's only my opinion...
    Jan

  • Problems with character displaying from XML to Java

    Hi to all!
    I am making a flash chat program which basically takes english and chinese
    and talk to java using XML and java server distribute this message to all users,
    While simply using java as a distributor of the data was fine, but when I try to
    keep records of the chat into the mysql database, I realized that all the
    chinese characters are displayed in random characters.
    After some thought, I realized that flash using ASCII number representation
    for each chinese word imay be different from the Java ASCII number representation, therefore, when Java sends
    these ASCII characters to the mysql database, the words is no longer the words I wanted.
    I am using a brute force, which on the flash side, I took the ASCII code of each chinese character that I
    typed and use break and send them to java and recoded in java with java's Chinese character
    and send to the mysql database, well, it works(I tried) but I need to type up at least 3000 characters!!!!!!!!
    this is insane!
    I am also wonder if the problem comes because Java encode Chinese in unicode, so
    it does not recognize the ASCII, and therefore, the result is for sure weird.
    If so, what do I need to do in order to convert ASCII into Unicode????
    sincerely,
    Suansworks

    hello.
    flash have some problems by utf but it seems that your problem is with mysql database because if you want to put utf in mysqk database you need to get latest version that is beta or alpha. please it using with other database that supports utf.

Maybe you are looking for

  • Not able to generate Jasper Report

    Hi All, Iam using Jasper report3.0 for generating reports. I have compiled jrxml file to jasper . But when i am running the application , iam getting the following error:- java.io.InvalidClassException: net.sf.jasperreports.engine.base.JRBaseReport;

  • How can i move all the music from my playlist on my ipod onto...

    OK, I have a 4G 20GB ipod that has reached its capacity...I have upgraded to the 5G 60GB video...I want to move my entire playlist from my old ipod onto the new one. I tried to click and carry the playlist onto the itunes playlist but I cannot?

  • Lion Server with PCs on Network

    This setup would be a Mac mini running OS X Lion Server serving only PCs. Anyone have experience and comments/suggestions on using Lion Server to serve PCs in a classroom environment? (Small school) What do you do about virus protection for PCs? Loca

  • Header columns alignment in PDF using CFDOCUMENTITEM

    Hi All, I'm creating a PDF with CFDOCUMENT tags and using CFSAVECONTENT tags. I will do the formatting everything inside the CFSAVECONTENT Variable and create the PDF using the save content variable. <cfdocument format="PDF" orientation="landscape">

  • Trying to get open nat for mw3 on ps3 WRT610n

    ive tried all types of things i read online and it is stuck on moderate no matter what i do, im hooked into router directly, when i hook directly into modem it switches to open... please help